<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<title></title> <jsp:include page="../common/head.jsp"></jsp:include>

<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>

	<form action="${path}/role/savePerm" method="post" class="definewidth m20">
		<input type="hidden" name="id" value="${id}" />
		<table class="table table-bordered table-hover definewidth m10">
			<tr>
				<td class="tableleft">权限</td>
				<td>
				<ul>
					<c:if test="${!empty list}">
						<c:forEach items="${list}" var="r">
							<c:if test="${ r.pid == 0}">
							<li>
							<label class='checkbox inline'><input
								type='checkbox' name='rid' value='${r.id}'
								${r.checked}
								 />${r.name}</label>
							<ul>
							<c:forEach items="${list}" var="rr">
								<c:if test="${ rr.pid==r.id}">
								<li><label class='checkbox inline'><input
										type='checkbox' name='rid' value='${rr.id}' ${rr.checked} />${rr.name}</label>
										<ul>
										<c:forEach items="${list}" var="rrr">
											<c:if test="${rrr.pid==rr.id}">
											<li>
												<label class='checkbox inline'><input
													type='checkbox' name='rid' value='${rrr.id}' ${rrr.checked} />${rrr.name}</label>
											</li>
											</c:if>
										</c:forEach>
										</ul>
								</c:if>
							</c:forEach>
							</ul>
							</li>
							</c:if>
						</c:forEach>
					</c:if>
					</ul></td>
			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn btn-success"
						id="backid" onclick="javascript:history.go(-1)">返回列表</button>
				</td>
			</tr>
		</table>
	</form>
	<jsp:include page="../common/foot.jsp"></jsp:include>
	<script>
		$(function() {
			$(':checkbox[name="rid"]').click(
					function() {
						$(':checkbox', $(this).closest('li')).prop('checked',
								this.checked);
					});
		});
	</script>
</body>
</html>
